package markgame2dphys;

import java.awt.Color;

import javax.swing.JFrame;

import net.phys2d.raw.Body;

public class Test2_Mass extends MarkGame2DEngine{

	private static final long serialVersionUID = 1L;

	public static final int W = 640;
	public static final int H = 480;

	public MarkGameBox boxLeft;
	public MarkGameBox boxRight;
	
	public MarkGameCircle base;
	public MarkGameBox balance;

	public Test2_Mass() {
		super(W,H,0,/*100*/50, 20, 30);

		boxLeft = new MarkGameBox(20, 20, 1.0f);
		boxLeft.body.setPosition(W/2-100, 50);
		add(boxLeft);
		
		boxRight = new MarkGameBox(20, 20, 1.1f);
		boxRight.body.setPosition(W/2+100, 50);
		add(boxRight);
		
		base = new MarkGameCircle(60, Body.INFINITE_MASS);
		base.body.setPosition(W/2, H);
		add(base);
		
		balance = new MarkGameBox(300, 30, 1);
		balance.body.setPosition(W/2, H-70);
		add(balance);
		
	}

	public void paint(MarkGameGraphics g) {

		g.setColor(Color.WHITE);
		g.fillRect(0,0,W,H);

		paintAllObjects(g);
		paintAllJoints(g);

	}

	public static void main(String[] args) {

		JFrame janela = new JFrame("teste1");
		janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		Test2_Mass app = new Test2_Mass();

		janela.getContentPane().add(app);

		janela.pack();
		janela.setVisible(true);

		janela.setLocationRelativeTo(null);

		janela.setExtendedState(JFrame.MAXIMIZED_BOTH);

		new Thread(app).start();

	}

}
